home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 25 / CU Amiga Magazine's Super CD-ROM 25 (1998)(EMAP Images)(GB)(Track 1 of 2)[!][issue 1998-08].iso / CUCD / Programming / QuakeTools / src / libqsys / m68k / m68k.h next >
Encoding:
C/C++ Source or Header  |  1998-06-11  |  2.4 KB  |  127 lines

  1. #ifndef    M68K_H
  2. #define    M68K_H
  3.  
  4. #if defined(__mc68030__)
  5. # include "LZW5b.h"
  6. #else /* __mc68030__ */
  7. # define    LZWSCrunch(a, b, c, d, e) (0)
  8. # define    LZWSDecrunch(a, b, c) (0)
  9. # define    LZWSSize(a) (0)
  10. # define    ERROR 0
  11. #endif /* __mc68030__ */
  12.  
  13. #if defined(BASE_REGISTER)
  14. # define    __memBase    register struct memory *bspMem __asm__ ("a6")
  15. #else /* BASE_REGISTER */
  16. # define    __memBase    struct memory *bspMem
  17. #endif /* BASE_REGISTER */
  18.  
  19. #define READ_BINARY "r"
  20. #define WRITE_BINARY "w"
  21. #define READWRITE_BINARY_OLD "r+"
  22. #define READWRITE_BINARY_NEW "w+"
  23.  
  24. #ifdef INLINE_BIGENDIAN_M68K
  25. #if defined(__STDC__) || defined(__cplusplus)
  26. #define _DEFUN(name, args1, args2) name ( args2 )
  27. #define _AND ,
  28. #define _CONST const
  29. #else
  30. #define _DEFUN(name, args1, args2) name args1 args2;
  31. #define _AND ;
  32. #define _CONST
  33. #endif
  34.  
  35. /*
  36.  define SWAPSHORT(i) (((i>>8)&0xff)|((i<<8)&0xff00))
  37.  */
  38. inline static _CONST unsigned short int 
  39. _DEFUN(SwapShort, (i), unsigned short int i) {
  40.   __asm volatile ("
  41.     ror%.w #8,%0
  42.     "
  43.     : "=d" (i)
  44.     : "0" (i)
  45.     : "cc");
  46.   return i;
  47. }
  48.  
  49. /*
  50.  define SWAPINT(i) (((i>>24)&0xff)|((i>>8)&0xff00)|((i<<8)&0xff0000)|((i<<24)&0xff000000))
  51.  */
  52. inline static _CONST unsigned int
  53. _DEFUN(SwapInt, (i), unsigned int i) {
  54.   __asm volatile ("
  55.     ror%.w #8,%0
  56.     "
  57.     : "=d" (i)
  58.     : "0" (i)
  59.     : "cc");
  60.   __asm volatile ("
  61.     swap %0
  62.     "
  63.     : "=d" (i)
  64.     : "0" (i)
  65.     : "cc");
  66.   __asm volatile ("
  67.     ror%.w #8,%0
  68.     "
  69.     : "=d" (i)
  70.     : "0" (i)
  71.     : "cc");
  72.   return i;
  73. }
  74.  
  75. inline static _CONST float
  76. _DEFUN(SwapFloat, (i), float i) {
  77.   __asm volatile ("
  78.     ror%.w #8,%0
  79.     "
  80.     : "=d" (i)
  81.     : "0" (i)
  82.     : "cc");
  83.   __asm volatile ("
  84.     swap %0
  85.     "
  86.     : "=d" (i)
  87.     : "0" (i)
  88.     : "cc");
  89.   __asm volatile ("
  90.     ror%.w #8,%0
  91.     "
  92.     : "=d" (i)
  93.     : "0" (i)
  94.     : "cc");
  95.   return i;
  96. }
  97.  
  98. #undef _DEFUN
  99. #undef _AND
  100. #undef _CONST
  101. #endif
  102.  
  103. #define    MATCH
  104.  
  105. /*
  106.  * ============================================================================
  107.  * structures
  108.  * ============================================================================
  109.  */
  110.  
  111. /*
  112.  * ============================================================================
  113.  * globals
  114.  * ============================================================================
  115.  */
  116.  
  117. /*
  118.  * ============================================================================
  119.  * prototypes
  120.  * ============================================================================
  121.  */
  122.  
  123. #undef    Match
  124. unsigned char Match(register struct rgb *rawpix __asm__ ("a0"), register struct rgb *Palette __asm__ ("a1"));
  125.  
  126. #endif
  127.